<template>
  <div>
    <div>
      <mt-header title="设置" style="background: linear-gradient(#000000, #035838);">
        <mt-button icon="back" slot="left" @click="goBack()">返回</mt-button>
      </mt-header>
    </div>
    <div>
      <mt-cell is-link>
        <span slot="title">推广员账号登录</span>
        <img slot="icon" src="../../assets/images/tool/tgy.png" width="20" height="20">
      </mt-cell>
      <mt-cell is-link>
        <span slot="title">旅行社账号登录</span>
        <img slot="icon" src="../../assets/images/tool/lxs.png" width="20" height="20">
      </mt-cell>
    </div>
    <div class="promoters-button" @click="exit()" v-show="showexitflag">
      <button class="mint-button mint-button--default mint-button--large is-plain">
        <label class="mint-button-text">退出登录</label>
      </button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      showexitflag: false
    };
  },
  created() {
    // 该方法用来更改tabbarshow的值 用来 展示、隐藏底部 tabbar (boolean为0 展示、boolean为1 隐藏)
    this.$store.dispatch("showTabbar", { boolean: "1" });
  },
  mounted() {
    let global_id = JSON.parse(localStorage.getItem("global_id"));
    if (global_id != "" && global_id != null) {
      this.showexitflag = true;
    }
  },

  methods: {
    goBack() {
      this.$store.dispatch("showTabbar", { boolean: "0" });
      history.go(-1);
    },
    exit() {
      this.$store.dispatch("showTabbar", { boolean: "0" });
      localStorage.clear();
      this.$router.push({ path: "/me" });
    }
  }
};
</script>

<style scoped>
.promoters-button {
  height: 150px;
  width: 80%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: auto;
}
</style>
